package rad.framework.mda.generator.template.main.webapp;

import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.*;
import java.util.*;
import rad.framework.mda.generator.util.*;

public class ListCellHeaders
{
  protected static String nl;
  public static synchronized ListCellHeaders create(String lineSeparator)
  {
    nl = lineSeparator;
    ListCellHeaders result = new ListCellHeaders();
    nl = null;
    return result;
  }

  public final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
  protected final String TEXT_1 = "<ui:composition " + NL + "\txmlns:ui=\"http://java.sun.com/jsf/facelets\"" + NL + "\txmlns:f=\"http://java.sun.com/jsf/core\"" + NL + "\txmlns:s=\"http://jboss.com/products/seam/taglib\"" + NL + "\txmlns:tt=\"https://code.google.com/p/rad-framework/pdf\"" + NL + "\txmlns:p=\"http://jboss.com/products/seam/pdf\">" + NL;
  protected final String TEXT_2 = NL + "\t<tt:header-cell label=\"#{messages['";
  protected final String TEXT_3 = "_";
  protected final String TEXT_4 = "']}\" rendered=\"true\" />";
  protected final String TEXT_5 = NL + "\t<tt:header-cell label=\"#{messages['";
  protected final String TEXT_6 = "_";
  protected final String TEXT_7 = "']}\" rendered=\"true\" />";
  protected final String TEXT_8 = NL + "\t<tt:header-cell label=\"#{messages['";
  protected final String TEXT_9 = "_";
  protected final String TEXT_10 = "']}\" rendered=\"true\" />";
  protected final String TEXT_11 = NL + "</ui:composition>";
  protected final String TEXT_12 = NL;

  public String generate(Object argument)
  {
    final StringBuffer stringBuffer = new StringBuffer();
    
Class uml2Class = (Class) argument;
String capClassName = NameHelper.getCapName(uml2Class);

    stringBuffer.append(TEXT_1);
    for (Iterator<Property> i=ClassHelper.getAllSimpleProperties(uml2Class); i.hasNext();) { Property property = i.next();
    String propertyName = NameHelper.uncapSafeName(property);
    stringBuffer.append(TEXT_2);
    stringBuffer.append(capClassName);
    stringBuffer.append(TEXT_3);
    stringBuffer.append(propertyName);
    stringBuffer.append(TEXT_4);
    }
    for (Iterator<Property> i=ClassHelper.getAllManyToOneProperties(uml2Class); i.hasNext();) { Property property = i.next();
    if ((property.getOpposite() == null || !property.getOpposite().isComposite())) {
    for (Iterator<Property> j=ClassHelper.getAllSimpleProperties((Class)property.getType()); j.hasNext();) { Property property2 = j.next();
    String property2Name = NameHelper.uncapSafeName(property2);
    stringBuffer.append(TEXT_5);
    stringBuffer.append(property.getType().getName());
    stringBuffer.append(TEXT_6);
    stringBuffer.append(property2Name);
    stringBuffer.append(TEXT_7);
    }
    for (Iterator<Property> k=ClassHelper.getAllManyToOneProperties((Class)property.getType()); k.hasNext();) { Property property2 = k.next();
    for (Iterator<Property> j=ClassHelper.getAllSimpleProperties((Class)property2.getType()); j.hasNext();) { Property property3 = j.next();
    String property3Name = NameHelper.uncapSafeName(property3);
    stringBuffer.append(TEXT_8);
    stringBuffer.append(property2.getType().getName());
    stringBuffer.append(TEXT_9);
    stringBuffer.append(property3Name);
    stringBuffer.append(TEXT_10);
    }
    }
    }}
    stringBuffer.append(TEXT_11);
    stringBuffer.append(TEXT_12);
    return stringBuffer.toString();
  }
}
